(function () {
    function startUp (){
      loadPath();
      loadPlugins();
    }
    startUp();
    function loadConfig () {
       var configObject =  {            
            //By default load any module IDs from default/scripts/app
            baseUrl: 'default/scripts/app',
            //waitSeconds: 300,
            //load it from the default/scripts/app directory. paths config is relative to the baseUrl, and the paths config could be for a directory.
            paths: {
              jquery: ['../lib/jquery-1.8.3'],
              ko: ['../lib/knockout-2.1.0'],
              amplify: ['../lib/amplify.1.1.0'],
              sammy: ['../lib/sammy.0.7.4'],
              toastr: '../lib/toastr',
              underscore: ['../lib/underscore.1.4.4'],
              i18next: '../lib/i18next-1.6.0',
              ko_activity: '../lib/knockout.activity',
              spin: '../lib/spin',
            },
            // Sets the configuration for your third party scripts that are not AMD compatible
            shim: {
                underscore: {
                    exports: '_'
                },
                toastr: {
                    deps: ["jquery"],
                    exports: 'toastr'
                },
                amplify: {
                    deps: ["jquery"],
                    exports: 'amplify'
                },
                sammy: {
                    deps: ["jquery"]
                },
                'ko_activity': {
                    deps: ["jquery"]
                },
                'spin': {
                    deps: ["jquery"]
                },
            }
        };
        return configObject;
    }
    function loadPath() {
        requirejs.config(loadConfig());
    }
    function loadPlugins() {        
        // Plugins must be loaded after jQuery and Knockout,
        // since they depend on them.
        requirejs([
          'ko.bindingHandlers','ko_activity'
        ], function(){
            $('#busyindicator').activity(true);           
          boot();          
        });
    }
    
    function boot() {
        require(['bootstrapper'], function (bs) { bs.run(); });
    }    
})();